using UnityEngine;
using System.Collections.Generic;

public class LadderTracker : MonoBehaviour {

	private int m_startColumn;
	private List<Vector3> m_tracePointList = null;
	
	private Ladder m_ladder = null;
	
	private LineRenderer m_renderer = null;
	private Color m_color1 = Color.red;
	private Color m_color2 = Color.white;
	private float m_width = 2f;
	
	public static LadderTracker Create(Ladder ladder, int startColumn)
	{
		GameObject ladderTrackerObj = new GameObject("LadderTracer");
		LadderTracker ladderTracker = ladderTrackerObj.AddComponent<LadderTracker>();
		ladderTracker.Initialize(ladder, startColumn);
		return ladderTracker;
	}
	
	private void Initialize(Ladder ladder, int startColumn)
	{
		m_ladder = ladder;
		m_startColumn = startColumn;
		m_tracePointList = new List<Vector3>();
		
		m_renderer = GetComponent<LineRenderer>();
		if (m_renderer == null)
		{
			m_renderer = gameObject.AddComponent<LineRenderer>();
		}
		
		//m_renderer.material = Material.Instantiate(Resources.Load("Materials/Column_Material")) as Material;
		m_renderer.material = Material.Instantiate(Resources.Load("Default-Particle")) as Material;
		//m_renderer.material = new Material(Shader.Find("Particles/Additive"));
		m_renderer.SetColors(m_color1, m_color2);
		m_renderer.SetWidth(m_width, m_width);
	}
	
	// Use this for initialization
	void Start () 
	{
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	private void Track()
	{
	}
}
